<template>
  <div class="nurse-member-select-dialog">
    <zdyDialog
      :visible.sync="visible"
      :dialog-title="title"
      :append-to-body="true"
      :footer="false"
      :width="'70%'"
      top="3vh"
      max-height="66vh"
    >
      <el-row :gutter="24">
        <!--侧边部门数据-->
        <el-col :xl="24">
          <div  >
            <!-- 搜索 -->
            <label class="el-form-item-label">名称</label>
            <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
            <rrOperation   />
          </div>
          <!--表格渲染-->
          <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;">
            <el-table-column prop="name" label="线片巷名称" />
            <el-table-column prop="createBy" label="创建人" />
            <el-table-column prop="updateBy" label="最后修改人" />
            <el-table-column prop="createTime" label="创建时间">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.createTime) }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="updateTime" label="更新时间">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.updateTime) }}</span>
              </template>
            </el-table-column>
            <el-table-column label="操作" width="150px" align="center">
              <template slot-scope="scope">
                <el-button type="primary" @click="tableSelect(scope.row)">选择</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!--分页组件-->
          <pagination />
        </el-col>
      </el-row>
    </zdyDialog>
  </div>
</template>

<script>
import crudTLinearLane from '@/api/system/tLinearLane'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
const defaultForm = { name: null, id: null, createBy: null, updateBy: null, createTime: null, updateTime: null }
export default {
  name: 'TLinearLane',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '线片巷', url: 'api/tLinearLane', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTLinearLane }})
  },
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      permission: {
        add: ['admin', 'tLinearLane:add'],
        edit: ['admin', 'tLinearLane:edit'],
        del: ['admin', 'tLinearLane:del']
      },
      rules: {
      }}
  },
  computed: {
    visible: {
      get() {
        return this.dialogVisible
      },
      set(val) {
        this.$emit('update:dialogVisible', val) // visible 改变的时候通知父组件
      }
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    tableSelect(row) {
      this.$emit('select', row)
    }
  }
}
</script>
<style scoped>
</style>

